package cfca.seal.web.service;

import cfca.seal.bean.AdminUser;
import cfca.seal.bean.OperationLog;
import cfca.seal.common.Page;
import cfca.seal.dao.main.IOperationLogDao;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class OperationLogService
{

  @Resource
  private IOperationLogDao operationLogDao;

  public Page<OperationLog> getAll(OperationLog operationLog, String pageno, AdminUser adminUser)
    throws Exception
  {
    Page page = this.operationLogDao.getPage(operationLog, pageno, adminUser.getUserType() > 0 ? adminUser.getId() : "");
    return page;
  }

  public boolean addOperationLog(OperationLog operationLog) {
    return this.operationLogDao.insert(operationLog);
  }

  public List<OperationLog> getAllForArchive(OperationLog operationLog, AdminUser adminUser) throws Exception {
    List list = this.operationLogDao.getLogForArchive(operationLog, adminUser.getUserType() > 0 ? adminUser.getId() : "");
    return list;
  }

  public void delete(OperationLog operationLog, AdminUser adminUser) throws Exception {
    this.operationLogDao.delete(operationLog, adminUser.getUserType() > 0 ? adminUser.getId() : "");
  }
}